
<#-- 导入模版定义文件-->
<#include "../template/template_editPage.ftl">
<@edit title="供货商提供的充值面额操作">
	<#if (supplierDenomination.id)??>
		<#assign isEdit = true />
	<#else>
		<#assign isAdd = true />
	</#if>
	<body class="input">
	<script type="text/javascript">
	$().ready( function() {			
		$("#type").click(function(){
			var flag=$("#type option:selected").val();
			if(flag==1){
				$("#maxFaceValuetr").show();
				$("#magniFicationtr").show();
				$("#faceValuetr").html("最低面值");
			}else{
				$("#maxFaceValuetr").hide();
				$("#magniFicationtr").hide();	
				$("#faceValuetr").val("面值");	
			}
		});
		$("#type").click();
		var $validateErrorContainer = $("#validateErrorContainer");
		var $validateErrorLabelContainer = $("#validateErrorContainer ul");
		var $validateForm = $("#validateForm");
		var $tab = $("#tab");        
		// Tab效果
		$tab.tabs(".tabContent", {
			tabs: "input"
		});		
		// 表单验证
		$validateForm.validate({
			errorContainer: $validateErrorContainer,
			errorLabelContainer: $validateErrorLabelContainer,
			wrapper: "li",
			errorClass: "validateError",
			ignoreTitle: true,
			rules: {
					"faceValue": {
						required: true,
						positively: true	
					},
					"costPrice": {
						required: true,
						positively: true	
					},
					"maxFaceValue": {
					    required: true,
						positively: true	
					},
					"supplierDenomination.magnification": {
					    required: true,
						positiveInteger: true	
					}					
			},
			messages: {
					"faceValue": {
						required: "面值不为空",
						positively: "面值必须为大于0的数字"   
					},	
					"costPrice": {
						required: "成本价不为空",
						positively: "成本价必须为大于0的数字"   
					},	
					"maxFaceValue": {
					    required: "最大面值不为空",
						positively: "最大面值必须为大于0的数字"  	
					},	
					"supplierDenomination.magnification": {
					    required: "倍数不为空",
						positiveInteger: "请输入正整数"
					}						
			},
			submitHandler: function(form) {
				$(form).find(":submit").attr("disabled", true);
				form.submit();
			}
		});
		<#if actionErrors??&&(actionErrors?size > 0)>
			$.dialog({type: "warn", content: "<#list errorMessages as list>${list}<br></#list>",
			 modal: true, autoCloseTime: 3000});
		</#if>
	});
	</script>
		<div class="body">
			<div class="inputBar">
				<h1><span class="icon">&nbsp;</span><#if isAdd??>添加充值面额<#else>编辑充值面额</#if></h1>
			</div>		
			<div style="display: none;" id="validateErrorContainer" class="validateErrorContainer">
				<div class="validateErrorTitle">以下信息填写有误,请重新填写</div>
				<ul></ul>
			</div>			
			<form id="validateForm" class="validate" method="post" action="<#if isAdd??>${web_base}/recharge/supplier_denomination!addDenomination.htm<#else>${web_base}/recharge/supplier_denomination!editDenomination.htm</#if>">
			<table class="inputTable tabContent">
			<tr>
				<th><span id="faceValuetr">面值</span>:<input type="hidden" name="supplierDenomination.id" value="<#if isEdit??>${(supplierDenomination.id)!}</#if>" >
				         <input type="hidden" class="formText" name="supplierDenomination.supplierRechargeModeId" value="<#if isAdd??>${(modeId)!}<#else>${supplierDenomination.supplierRechargeModeId}</#if>" ></th>
				<td><input type="text" name="faceValue" value="${money((supplierDenomination.faceValue)!)}" ><label class="requireField">*</label></td>
			</tr>
			<tr>
				<th>成本价:</th>
				<td><input type="text" name="costPrice" value="${money((supplierDenomination.costPrice)!)}" ><label class="requireField">*</label></td>
			</tr>	
			<tr>
				<th>是否启用:</th>
				<td><select name="supplierDenomination.enable">
				    <option value="false" <#if isEdit??><#if supplierDenomination.enable?string('true','false')=="false">selected="selected"</#if></#if> >否</option>
					<option value="true"  <#if isEdit??><#if supplierDenomination.enable?string('true','false')=="true">selected="selected"</#if></#if> >是</option>
				    </select>
				</td>
			</tr>
			<tr>
				<th>面值表现方式:</th>
				<td><select name="supplierDenomination.type" id="type">
				    <option value="0" <#if isEdit??><#if supplierDenomination.type?default(0)==0>selected="selected"</#if></#if> >固定面值</option>
					<option value="1" <#if isEdit??><#if supplierDenomination.type?default(0)==1>selected="selected"</#if></#if> >比例算</option>
				    </select>
				</td>
			</tr>
			<tr id="maxFaceValuetr" style="display:none">
				<th>最大面值:</th>
				<td><input type="text" class="formText" name="maxFaceValue" value="${money((supplierDenomination.maxFaceValue)!)}" ></td>
			</tr>			
			<tr id="magniFicationtr" style="display:none">
				<th>倍数:</th>
				<td><input type="text" class="formText" name="supplierDenomination.magnification" value="${(supplierDenomination.magnification)!}" ></td>
			</tr>
			</table>
			<div class="buttonArea">
				<input type="submit" class="formButton" value="<#if isAdd??>添加<#else>修改</#if>" hidefocus="true" />&nbsp;&nbsp;&nbsp;&nbsp;
				<input type="button" class="formButton" onclick="window.history.back(); return false;" value="返  回" hidefocus="true" />
			</div>
			</form>
		</div>
	</body>

</@edit>